<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>${title }</title>
<link href="../../resources/home/exam/css/main.css" rel="stylesheet" type="text/css" />
<link href="../../resources/home/exam/css/iconfont.css" rel="stylesheet" type="text/css" />
<link href="../../resources/home/exam/css/test.css" rel="stylesheet" type="text/css" />
<style>
.hasBeenAnswer {
	background: #5d9cec;
	color:#fff;
}
</style>

</head>
<body>
<div class="main">
	<!--nr start-->
	<div class="test_main">
		<div class="test_title">
			<p class="test_time">
				<img style="float:left;margin-top:15px;margin-left:10px;" src="../../resources/home/exam/images/time.png" width="16px"><b class="alt-1">
				<span>已学习时间：<span id="time"></span></span>
			</b>
			</p>
		</div>
		<video id="video1" width="1080" height="auto" style="margin-top:15px;" controls="" autoplay="" name="media">
			 <source src="${src}" type="video/mp4" style="width:100%;height:100%"/>
		</video>
	</div>
	<!--nr end-->
	<div class="foot"></div>
</div>

<script src="../../resources/home/exam/js/jquery-1.11.3.min.js"></script>
<script src="../../resources/home/exam/js/jquery.easy-pie-chart.js"></script>
<!--时间js-->
<script src="../../resources/home/exam/js/jquery.countdown.js"></script>
<script>
	var vedio = document.getElementById("video1");
	var timespan = 0;
	var isCountTime = false;
	vedio.onplaying = function () {
		isCountTime = true;
		console.log("playing");
	}
	vedio.onwaiting = function () {
		isCountTime = false;
		console.log("waiting");
	}
	vedio.onpause = function () {
	    isCountTime = false;
		console.log("pasused");
	}
	setInterval(function () {
		if (isCountTime) {
			timespan += 1;
			document.getElementById("time").innerHTML = timespan;
			$.ajax({
				type: "POST",
				url: "addStudy",
				dataType:'json',
				type: "POST",
				dataType: "json",
				data: {"id":'${id}',"time":timespan},
				success: function(data){},
				error : function(){}
			});

		}
	}, 1000);
	

</script>

<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>积欠考试在线考试系统</p>
<p><a href="http://www.jmi.edu.cn/" target="_blank">【江苏海事职业技术学院】</a></p>
</div>
</body>
</html>